import Vue from 'vue'
import Router from 'vue-router'
// @符号表示src目录

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      // 异步加载页面请求
      component: ()=>import('@/pages/home/Home')
    },
    {
      path: '/city',
      name: 'City',
      component:  ()=>import('@/pages/city/City')
    },
    {
      path: '/detail/:id',
      name: 'Detail',
      component:  ()=>import('@/pages/detail/Detail')
    }
  ],
  // 点击跳转 回到顶部
  scrollBehavior (to, from, savedPosition) {
    return{x:0,y:0}
  }
})
